﻿@using Webdiyer.WebControls.Mvc;
@model PagedList<Alabama.TieuDe>
@{
    ViewBag.Title = "Lịch công tác đã tổng hợp";
}
<h3>
    @ViewBag.Title</h3>
<div class="row-fluid">
    <div class="row-fluid">
        @if (Request.IsAuthenticated)
        {
            <div class="span12">
                @Html.ActionLink("Tạo mới", "NewOrEdit", null, new { @class = "btn btn-info" })
            </div>
        }
    </div>
    <div class="row-fluid">
        <div class="span12">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th style="width: 3%;">
                            STT
                        </th>
                        <th>
                            Danh sách lịch công tác đã tổng hợp
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @{ var stt = (int)ViewBag.STT;
                       foreach (var item in Model)
                       {
                           if (item.TongHop != null)
                           {
                        <tr>
                            <td>
                                @(stt++)
                            </td>
                            <td>
                                <a href="@Url.Action("NewOrEdit", new { fromDate = item.TongHop.FirstOrDefault().FromDate.ToString("dd/MM/yyyy"), endDate = "" })">
                                    <span style="text-align: center">@Html.Raw(item.Title.Replace("\n", "<br />"))</span></a>
                            </td>
                            <td>
                                @if (ViewBag.SuaXoaLichCongTac != null && (bool)ViewBag.SuaXoaLichCongTac)
                                {
                                    @Html.ActionLink("Xóa", "DeleteLichCongTacByTitleID", new { id = item.ID }, new { Class = "confirmDelete" })
                                }
                            </td>
                        </tr>
                           }
                       }}
                </tbody>
            </table>
            <div class="row-fluid">
                <div class="span4">
                    <div class="dataTables_info">
                        @if (Model.TotalItemCount > 0)
                        {
                            if (Model.TotalItemCount < Model.PageSize)
                            {
                            <span>1 </span>
                            <span>- </span>@Model.TotalItemCount
                            }
                            else
                            {
                            <span></span>@((Model.CurrentPageIndex - 1) * Model.PageSize + 1)
                            <span>- </span>@((Model.CurrentPageIndex != Model.TotalPageCount) ? (Model.CurrentPageIndex * Model.PageSize) : Math.Abs((Model.CurrentPageIndex) * Model.PageSize - (Model.PageSize * Model.TotalPageCount) - Model.TotalItemCount))
                            }
                            <span>of </span>@(Model.TotalItemCount)
                            
                        }
                    </div>
                </div>
                <div class="span8">
                    <div class="dataTables_paginate paging_bootstrap pagination phantrangmvcpager">
                        @Html.Pager(Model, new PagerOptions { ContainerTagName = "ul", PageIndexParameterName = "page", CurrentPagerItemWrapperFormatString = "<li class='active'>{0}</li>", CurrentPageNumberFormatString = "{0}", FirstPageText = "&laquo; ", LastPageText = " &raquo;", NextPageText = "Trang sau →", PrevPageText = "← Trang trước", SeparatorHtml = "" })
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
